home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Data 2002 May / CD Rom Data Mayıs 2002.iso / Freeware / Blitz Basic / data1.cab / Support / help / samples / rain.bb < prev    next >
Encoding:
Text File  |  2002-04-10  |  1.5 KB  |  68 lines

  1. ;Blitz rain effect
  2. ;Copyright ⌐2000 EdzUp
  3. ;written by Ed Upton
  4.  
  5. ;play with this for light or heavy rain!!!
  6. Global drop_number=200
  7.  
  8. Graphics 640,480
  9. SetBuffer BackBuffer()
  10.  
  11. Type drop
  12.  Field x,y
  13.  Field angle,col
  14. End Type
  15.  
  16. Global wind
  17.  
  18. placedrops()
  19.  
  20. While Not KeyDown(1)
  21.  Cls
  22.  update()
  23.  If KeyDown(75)=1 Then wind=wind-25
  24.  If KeyDown(77)=1 Then wind=wind+25
  25.  If wind>3000 Then wind=3000
  26.  If wind<-3000 Then wind=-3000
  27.  Color 255,255,255
  28.  Text 0,0,"Wind speed:"+wind
  29.  Text 320,460,"Numpad 4 and 6 adjust wind speed",1
  30.  Flip
  31. Wend
  32. End
  33.  
  34. ;place drops on the screen
  35. Function placedrops()
  36.  For n=0 To drop_number
  37.   drip.drop = New drop
  38.   al=Rnd(2048)
  39.   drip\x=al-704
  40.   drip\y=Rnd(380)
  41.   drip\angle=0     ;straight down (This is modified by wind)
  42.   drip\col=Rnd(4)
  43.  Next
  44. End Function
  45.  
  46. Function update()
  47.  ;adjust the 12 at the end of the Sin and Cos lines for faster rain
  48.  For drip.drop = Each drop
  49.   xx=Sin((2*(drip\angle+wind))*Pi/360)*12
  50.   yy=Cos((2*(drip\angle+wind))*Pi/360)*12
  51.   If drip\col=0 Then Color 200,200,200 Else
  52.   If drip\col=1 Then Color 150,150,150 Else
  53.   If drip\col=2 Then Color 100,100,100 Else
  54.   If drip\col=3 Then Color 50,50,50
  55.   Line drip\x,drip\y,drip\x+(xx/2),drip\y+(yy/2)
  56.   drip\x=drip\x+xx
  57.   drip\y=drip\y+yy
  58.   If drip\y>430
  59.    percent=Rnd(100)
  60.    If percent<50 Or drip\y>475
  61.     al=Rnd(2048)
  62.     drip\x=al-704
  63.     drip\y=Rnd(100)
  64.     drip\angle=0     ;straight down (This is modified by wind)
  65.    EndIf
  66.   EndIf
  67.  Next
  68. End Function